package com.yyh;

public class Rectangles {
    //属性
    //第一条边
    private double length1;
    //第二条边
    private double length2;
    //第三条边
    private double length3;
    //无参构造方法
    public Rectangles() {
    }
    //有参构造方法
    public Rectangles(double length1, double length2, double length3) {
        this.length1 = length1;
        this.length2 = length2;
        this.length3 = length3;
    }
    //setter and getter
    public double getLength1() {
        return length1;
    }

    public void setLength1(double length1) {
        this.length1 = length1;
    }

    public double getLength2() {
        return length2;
    }

    public void setLength2(double length2) {
        this.length2 = length2;
    }

    public double getLength3() {
        return length3;
    }

    public void setLength3(double length3) {
        this.length3 = length3;
    }
    //行为
    //三角形面积方法
    public double getArea(){
        double p = (length1+length2+length3)/2;
        return Math.sqrt(p*(p-length1)*(p-length2)*(p-length3));
    }
    //矩形周长方法
    public double getPerimeter(){
        return length1+length2+length3;
    }
    //打印矩形信息方法
    public String getInfo(){
        return "第一条边："+length1+",第二条边："+length2+",第三条边："+length3+",面积："+getArea()+",周长："+getPerimeter();

    }
}
